import App, { AppRunConfig } from "../../App";
import CONNECT_POOL from "../../ConnectPool";
import LsParser from "../../parser/LsParser";
import Loading from "../../ui/core/Loading";
import { Tab } from "../../ui/core/TabBar";
import box from "../../view";

export default class FileManagerApp extends App{
    version: string="0.1";
    async onStart(config:AppRunConfig) {
        // this.page=new FileManager()
        this.page.setInnerElement(new Loading({
            type:"LoadingTest2"
        }))
        let tab:Tab|undefined
        if(!config.tab){
            let tabId=box.addNewTab({
                name:'文件管理器',
                page:this.page,
                active:false
            })
            tab=box.getTab(tabId);
        }else{
            tab=config.tab
        }
        if(!tab){
            throw new Error("标签未注册");
        }
        tab.setName("文件管理器")
        let connectId=await CONNECT_POOL.createConnect((conn)=> new LsParser(conn,<Tab>tab));
    }
}